package com.ymatou.apigateway.testcase;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.apigateway.parameter.AesUtil;
import com.ymatou.apigateway.parameter.DeliverOrder;
import com.ymatou.apigateway.parameter.OpenapiReq;
import com.ymatou.apigateway.parameter.SendLogisticsResult;
import com.ymatou.apigateway.parameter.SendLogisticsReturn;
import com.ymatou.apigateway.parameter.SendlogisticsBean;
import com.ymatou.apigateway.service.OpenapiService;
import com.ymatou.apigateway.service.V1sendlogisticsCall;
import com.ymatou.iapi.optrade.parameter.enums.AuthenticateFeeTypeEnum;
import com.ymatou.iapi.optrade.parameter.enums.AuthenticateFreightTypeEnum;
import com.ymatou.iapi.optrade.parameter.enums.LogisticsTypeEnum;
import com.ymatou.iapi.optrade.resp.TradingServiceResp;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.YMTTrading.TradingCallService;
import com.ymttest.business.service.YMTTrading.TradingPlaceAuthenticateCallService;
import com.ymttest.business.service.YMTTrading.TradingPlaceOrderCallService;
import com.ymttest.database.model.Application;
import com.ymttest.database.model.AuthCode;
import com.ymttest.database.sqlwapper.OpenApiWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;
/**
*订单发货
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_V1sendlogistics {

	private static OpenapiReq openapiReq;
	private static SendlogisticsBean v1sendlogisticsBean;
	private static V1sendlogisticsCall v1sendlogisticsCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("订单发货");
	}

	@Before
	public void caseUp() {
		openapiReq = new OpenapiReq();
		openapiReq.setMethod("ymatou.order.deliver");

		v1sendlogisticsBean = new SendlogisticsBean();
		v1sendlogisticsCall = new V1sendlogisticsCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(v1sendlogisticsCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_001() {
		Logger.start(true, "订单发货");
		try {

			TradingServiceResp placeOrderResp = TradingPlaceOrderCallService
					.placeOrderWithLogisticsType(LogisticsTypeEnum.OVERSEAS_DELIVERY);
			
			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();
			
			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();
			
			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			DeliverOrder deliverOrder = new DeliverOrder();

			deliverOrder.setOrder_id(orderId);
			deliverOrder.setLogistics_company_id("Y013");
			deliverOrder.setTracking_number(TestDataManager.getRandomNum(13));
			deliverOrder.setIs_domestic_delivery(false);
			
//			deliverOrder.setOrder_id(12220368699L);
//			deliverOrder.setLogistics_company_id("Y068");
//			deliverOrder.setTracking_number("DB2533011982US");
//			deliverOrder.setIs_domestic_delivery(false);

			List<DeliverOrder> orders = new ArrayList<>();
			orders.add(deliverOrder);

			v1sendlogisticsBean.setDeliver_orders(orders);

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0000", v1sendlogisticsCall.getCode(), "验证Code");

			SendLogisticsResult sendLogisticsResult = v1sendlogisticsCall
					.getSendLogisticsResult();
			SendLogisticsReturn returnresult = sendLogisticsResult.getResults()
					.get(0);

			Logger.verifyEquals(v1sendlogisticsBean.getDeliver_orders().get(0)
					.getOrder_id(), (long) returnresult.getOrder_id(), "验证Code");
			Logger.verifyEquals(true, returnresult.isExec_success(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_002() {
		Logger.start(true, "订单发货-order_id空");
		try {
			TradingServiceResp placeOrderResp = TradingPlaceOrderCallService
					.placeOrderWithLogisticsType(LogisticsTypeEnum.OVERSEAS_DELIVERY);
			
			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();
			
			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();
			
			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			DeliverOrder deliverOrder = new DeliverOrder();

			deliverOrder.setLogistics_company_id("Y066");
			deliverOrder.setTracking_number(TestDataManager.getRandomNum(11));
			deliverOrder.setIs_domestic_delivery(false);

			List<DeliverOrder> orders = new ArrayList<>();
			orders.add(deliverOrder);

			v1sendlogisticsBean.setDeliver_orders(orders);

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0001", v1sendlogisticsCall.getCode(), "验证Code");
			Logger.verifyEquals("deliverOrderInfos[0].orderId:订单号不能小于1", v1sendlogisticsCall.getMessage(), "验证msg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_003() {
		Logger.start(true, "订单发货-logistics_company_id空");
		try {

			TradingServiceResp placeOrderResp = TradingPlaceOrderCallService
					.placeOrderWithLogisticsType(LogisticsTypeEnum.OVERSEAS_DELIVERY);
			
			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();
			
			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();
			
			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			DeliverOrder deliverOrder = new DeliverOrder();

			deliverOrder.setOrder_id(orderId);
			deliverOrder.setTracking_number(TestDataManager.getRandomNum(11));
			deliverOrder.setIs_domestic_delivery(false);

			List<DeliverOrder> orders = new ArrayList<>();
			orders.add(deliverOrder);

			v1sendlogisticsBean.setDeliver_orders(orders);

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0001", v1sendlogisticsCall.getCode(), "验证Code");
			Logger.verifyEquals("deliverOrderInfos[0].logisticsCompanyId:不能为空", 
					v1sendlogisticsCall.getMessage(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_004() {
		Logger.start(true, "订单发货-tracking_number空");
		try {

			TradingServiceResp placeOrderResp = TradingPlaceOrderCallService
					.placeOrderWithLogisticsType(LogisticsTypeEnum.OVERSEAS_DELIVERY);
			
			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();
			
			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();
			
			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			DeliverOrder deliverOrder = new DeliverOrder();

			deliverOrder.setOrder_id(orderId);
			deliverOrder.setLogistics_company_id("Y066");
			deliverOrder.setIs_domestic_delivery(false);

			List<DeliverOrder> orders = new ArrayList<>();
			orders.add(deliverOrder);

			v1sendlogisticsBean.setDeliver_orders(orders);

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0001", v1sendlogisticsCall.getCode(), "验证Code");
			Logger.verifyEquals("deliverOrderInfos[0].trackingNumber:may not be empty", 
					v1sendlogisticsCall.getMessage(), "验证msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_V1sendlogistics_006() {
		Logger.start(true, "订单发货-is_domestic_delivery空");
		try {
			
			TradingServiceResp placeOrderResp = TradingPlaceOrderCallService
					.placeOrderWithLogisticsType(LogisticsTypeEnum.OVERSEAS_DELIVERY);
			
			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();
			
			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();
			
			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			DeliverOrder deliverOrder = new DeliverOrder();

			deliverOrder.setOrder_id(orderId);
			deliverOrder.setLogistics_company_id("Y070");
			deliverOrder.setTracking_number(TestDataManager.getRandomNum(12));

			List<DeliverOrder> orders = new ArrayList<>();
			orders.add(deliverOrder);

			v1sendlogisticsBean.setDeliver_orders(orders);

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0000", v1sendlogisticsCall.getCode(), "验证Code");

			SendLogisticsResult results = v1sendlogisticsCall
					.getSendLogisticsResult();
			SendLogisticsReturn result = results.getResults().get(0);

			Logger.verifyEquals("订单Api发货失败", result.getMsg(), "验证msg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_007() {
		Logger.start(true, "订单发货-order_id不存在");
		try {

			OpenApiWapper openApiWapper = new OpenApiWapper();

			DeliverOrder deliverOrder = new DeliverOrder();

			deliverOrder.setOrder_id(1125312462);
			deliverOrder.setLogistics_company_id("Y066");
			deliverOrder.setTracking_number(TestDataManager.getRandomNum(11));
			deliverOrder.setIs_domestic_delivery(false);

			List<DeliverOrder> orders = new ArrayList<>();
			orders.add(deliverOrder);

			v1sendlogisticsBean.setDeliver_orders(orders);

			long sellerId = Long.valueOf(EnvSetup.getData("SellerId"));

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0000", v1sendlogisticsCall.getCode(), "验证Code");

			SendLogisticsResult results = v1sendlogisticsCall
					.getSendLogisticsResult();
			SendLogisticsReturn result = results.getResults().get(0);

			Logger.verifyEquals("订单不存在", result.getMsg(), "验证msg");
			Logger.verifyEquals(v1sendlogisticsBean.getDeliver_orders().get(0)
					.getOrder_id(), (long) result.getOrder_id(), "验证Code");
			Logger.verifyEquals(false, result.isExec_success(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_008() {
		Logger.start(true, "订单发货-logistics_company_id不存在");
		try {
			TradingServiceResp placeOrderResp = TradingPlaceOrderCallService
					.placeOrderWithLogisticsType(LogisticsTypeEnum.OVERSEAS_DELIVERY);
			
			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();
			
			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();
			
			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			DeliverOrder deliverOrder = new DeliverOrder();

			deliverOrder.setOrder_id(orderId);
			deliverOrder.setLogistics_company_id("Y070");
			deliverOrder.setTracking_number(TestDataManager.getRandomNum(11));
			deliverOrder.setIs_domestic_delivery(false);

			List<DeliverOrder> orders = new ArrayList<>();
			orders.add(deliverOrder);

			v1sendlogisticsBean.setDeliver_orders(orders);

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0000", v1sendlogisticsCall.getCode(), "验证Code");

			SendLogisticsResult results = v1sendlogisticsCall
					.getSendLogisticsResult();
			SendLogisticsReturn result = results.getResults().get(0);

			Logger.verifyEquals("物流公司买手不可用", result.getMsg(), "验证Code");
			Logger.verifyEquals(v1sendlogisticsBean.getDeliver_orders().get(0)
					.getOrder_id(), (long) result.getOrder_id(), "验证Code");
			Logger.verifyEquals(false, result.isExec_success(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_013() {
		Logger.start(true, "订单发货-多笔订单发货");
		try {

			List<DeliverOrder> orders = new ArrayList<>();
			long sellerId = 0;
			for (int i = 0; i < 4; i++) {
				TradingServiceResp placeOrderResp = TradingPlaceOrderCallService
						.placeOrderWithLogisticsType(LogisticsTypeEnum.OVERSEAS_DELIVERY);
				
				sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

				long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

				long userId = placeOrderResp.getUserId();

				long tradingId = placeOrderResp.getTradingId();
				
				BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();
				
				TradingCallService.payOrder(userId, useAccountAmount, tradingId);

				TradingCallService.sellerAcceptOrder(sellerId, orderId);

				DeliverOrder deliverOrder = new DeliverOrder();

				deliverOrder.setOrder_id(orderId);
				deliverOrder.setLogistics_company_id("Y066");
				deliverOrder.setTracking_number(TestDataManager
						.getRandomNum(12));
				deliverOrder.setIs_domestic_delivery(false);

				orders.add(deliverOrder);

			}

			OpenApiWapper openApiWapper = new OpenApiWapper();

			v1sendlogisticsBean.setDeliver_orders(orders);

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0000", v1sendlogisticsCall.getCode(), "验证Code");

			SendLogisticsResult results = v1sendlogisticsCall
					.getSendLogisticsResult();

			for (int i = 0; i < results.getResults().size(); i++) {
				SendLogisticsReturn result = results.getResults().get(i);

				Logger.verifyEquals(v1sendlogisticsBean.getDeliver_orders()
						.get(i).getOrder_id(), (long) result.getOrder_id(),
						"验证Code");
				Logger.verifyEquals(true, result.isExec_success(), "验证Code");
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_014() {
		Logger.start(true, "他人订单发货");
		try {

			TradingServiceResp placeOrderResp = TradingPlaceOrderCallService
					.placeOrderWithLogisticsType(LogisticsTypeEnum.OVERSEAS_DELIVERY);
			
			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();
			
			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();
			
			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			DeliverOrder deliverOrder = new DeliverOrder();

			deliverOrder.setOrder_id(orderId);
			deliverOrder.setLogistics_company_id("Y066");
			deliverOrder.setTracking_number(TestDataManager.getRandomNum(12));
			deliverOrder.setIs_domestic_delivery(false);

			List<DeliverOrder> orders = new ArrayList<>();
			orders.add(deliverOrder);

			v1sendlogisticsBean.setDeliver_orders(orders);

			Application application = openApiWapper
					.selectApplicationBySellerId(
							Long.valueOf(EnvSetup.getData("SellerId"))).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0000", v1sendlogisticsCall.getCode(), "验证Code");

			SendLogisticsResult sendLogisticsResult = v1sendlogisticsCall
					.getSendLogisticsResult();
			SendLogisticsReturn returnresult = sendLogisticsResult.getResults()
					.get(0);

			Logger.verifyEquals(v1sendlogisticsBean.getDeliver_orders().get(0)
					.getOrder_id(), (long) returnresult.getOrder_id(), "验证Code");
			Logger.verifyEquals(false, returnresult.isExec_success(), "验证Code");
			Logger.verifyEquals("订单不存在", returnresult.getMsg(), "验证msg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_015() {
		Logger.start(true, "订单发货一次超过10笔订单");
		try {

			List<DeliverOrder> orders = new ArrayList<>();

			for (int i = 0; i < 11; i++) {

				DeliverOrder deliverOrder = new DeliverOrder();

				deliverOrder.setOrder_id(22222222);
				deliverOrder.setLogistics_company_id("Y066");
				deliverOrder.setTracking_number(TestDataManager
						.getRandomNum(11));
				deliverOrder.setIs_domestic_delivery(false);

				orders.add(deliverOrder);

			}

			OpenApiWapper openApiWapper = new OpenApiWapper();

			v1sendlogisticsBean.setDeliver_orders(orders);

			Application application = openApiWapper
					.selectApplicationBySellerId(
							Long.valueOf(EnvSetup.getData("SellerId"))).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0001", v1sendlogisticsCall.getCode(), "验证Code");

			Logger.verifyEquals("deliverOrderInfos:单次发货不能超过10个订单",
					v1sendlogisticsCall.getMessage(), "验证message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_016() {
		Logger.start(true, "订单国内段转运发货");
		try {

			TradingServiceResp placeOrderResp = TradingPlaceOrderCallService
					.placeOrderWithLogisticsType(LogisticsTypeEnum.OVERSEAS_DELIVERY);
			
			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();
			
			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();
			
			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			DeliverOrder deliverOrder = new DeliverOrder();

			deliverOrder.setOrder_id(orderId);
			deliverOrder.setLogistics_company_id("Y013");
			deliverOrder.setTracking_number(TestDataManager.getRandomNum(13));
			deliverOrder.setIs_domestic_delivery(false);

			List<DeliverOrder> orders = new ArrayList<>();
			orders.add(deliverOrder);

			v1sendlogisticsBean.setDeliver_orders(orders);

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			deliverOrder.setTracking_number(TestDataManager.getRandomNum(12));
			deliverOrder.setIs_domestic_delivery(true);

			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0000", v1sendlogisticsCall.getCode(), "验证Code");

			SendLogisticsResult sendLogisticsResult = v1sendlogisticsCall
					.getSendLogisticsResult();
			SendLogisticsReturn returnresult = sendLogisticsResult.getResults()
					.get(0);

			Logger.verifyEquals(v1sendlogisticsBean.getDeliver_orders().get(0)
					.getOrder_id(), (long) returnresult.getOrder_id(), "验证Code");
			Logger.verifyEquals(true, returnresult.isExec_success(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_017() {
		Logger.start(true, "发货业务参数Biz_content为null");
		try {

			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(288484)).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			//openapiReq.setBiz_content("");
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0001", v1sendlogisticsCall.getCode(), "验证Code");

			Logger.verifyEquals("参数错误", v1sendlogisticsCall.getMessage(),
					"验证message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_018() {
		Logger.start(true, "发货业务参数Biz_content为空");
		try {

			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(288484)).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content("");
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0001", v1sendlogisticsCall.getCode(), "验证Code");

			Logger.verifyEquals("参数错误", v1sendlogisticsCall.getMessage(),
					"验证message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_019() {
		Logger.start(true, "订单发货使用顺丰国际，传入手机号，发货成功");
		try {

			long sellerId = 3383;
			String sellerName = "wesper";
			TradingServiceResp placeOrderResp = TradingPlaceOrderCallService
					.placeOrder(LogisticsTypeEnum.OVERSEAS_DELIVERY, sellerId, sellerName);

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();
			
			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();
			
			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			DeliverOrder deliverOrder = new DeliverOrder();

			deliverOrder.setOrder_id(orderId);
			deliverOrder.setLogistics_company_id("Y073");
			deliverOrder.setTracking_number(TestDataManager.getRandomNum(12));
			deliverOrder.setIs_domestic_delivery(false);
			deliverOrder.setMobile(TestDataManager.getCommPhoneNum());

			List<DeliverOrder> orders = new ArrayList<>();
			orders.add(deliverOrder);

			v1sendlogisticsBean.setDeliver_orders(orders);

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0000", v1sendlogisticsCall.getCode(), "验证Code");

			SendLogisticsResult sendLogisticsResult = v1sendlogisticsCall
					.getSendLogisticsResult();
			SendLogisticsReturn returnresult = sendLogisticsResult.getResults()
					.get(0);

			Logger.verifyEquals(v1sendlogisticsBean.getDeliver_orders().get(0)
					.getOrder_id(), (long) returnresult.getOrder_id(), "验证Code");
			Logger.verifyEquals(true, returnresult.isExec_success(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_020() {
		Logger.start(true, "订单发货使用顺丰国际，不传入手机号，发货失败");
		try {

			long sellerId = 3383;
			String sellerName = "wesper";
			TradingServiceResp placeOrderResp = TradingPlaceOrderCallService
					.placeOrder(LogisticsTypeEnum.OVERSEAS_DELIVERY, sellerId, sellerName);

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();
			
			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();
			
			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			DeliverOrder deliverOrder = new DeliverOrder();

			deliverOrder.setOrder_id(orderId);
			deliverOrder.setLogistics_company_id("Y073");
			deliverOrder.setTracking_number(TestDataManager.getRandomNum(12));
			deliverOrder.setIs_domestic_delivery(false);

			List<DeliverOrder> orders = new ArrayList<>();
			orders.add(deliverOrder);

			v1sendlogisticsBean.setDeliver_orders(orders);

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0000", v1sendlogisticsCall.getCode(), "验证Code");

			Logger.verifyEquals("发货物流公司必须提供手机号码", v1sendlogisticsCall.getSendLogisticsResult().getResults().get(0).getMsg(),
					"验证message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_021() {
		Logger.start(true, "订单发货， 发鉴定包裹");
		try {

			TradingServiceResp placeOrderResp = TradingPlaceAuthenticateCallService
					.placeOrderWithAuthenticate(
							AuthenticateFreightTypeEnum.BUYER, BigDecimal.ONE,
							AuthenticateFeeTypeEnum.BUYER, BigDecimal.TEN);
			
			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();
			
			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();
			
			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			DeliverOrder deliverOrder = new DeliverOrder();

			deliverOrder.setOrder_id(orderId);
			deliverOrder.setLogistics_company_id("Y013");
			deliverOrder.setTracking_number(TestDataManager.getRandomNum(13));
			deliverOrder.setIs_domestic_delivery(false);
			deliverOrder.setAuthenticate_package(true);

			List<DeliverOrder> orders = new ArrayList<>();
			orders.add(deliverOrder);

			v1sendlogisticsBean.setDeliver_orders(orders);

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0000", v1sendlogisticsCall.getCode(), "验证Code");

			SendLogisticsResult sendLogisticsResult = v1sendlogisticsCall
					.getSendLogisticsResult();
			SendLogisticsReturn returnresult = sendLogisticsResult.getResults()
					.get(0);

			Logger.verifyEquals(v1sendlogisticsBean.getDeliver_orders().get(0)
					.getOrder_id(), (long) returnresult.getOrder_id(), "验证Code");
			Logger.verifyEquals(true, returnresult.isExec_success(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_022() {
		Logger.start(true, "订单发货， 补录一个国内鉴定包裹");
		try {

			TradingServiceResp placeOrderResp = TradingPlaceAuthenticateCallService
					.placeOrderWithAuthenticate(
							AuthenticateFreightTypeEnum.BUYER, BigDecimal.ONE,
							AuthenticateFeeTypeEnum.BUYER, BigDecimal.TEN);
			
			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();
			
			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);
			Thread.sleep(3000);

			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, "Y013", 1, true);
			Thread.sleep(3000);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			DeliverOrder deliverOrder = new DeliverOrder();

			deliverOrder.setOrder_id(orderId);
			deliverOrder.setLogistics_company_id("Y037");
			deliverOrder.setTracking_number(TestDataManager.getRandomNum(13));
			deliverOrder.setIs_domestic_delivery(true);
			deliverOrder.setAuthenticate_package(true);

			List<DeliverOrder> orders = new ArrayList<>();
			orders.add(deliverOrder);

			v1sendlogisticsBean.setDeliver_orders(orders);

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0000", v1sendlogisticsCall.getCode(), "验证Code");

			SendLogisticsResult sendLogisticsResult = v1sendlogisticsCall
					.getSendLogisticsResult();
			SendLogisticsReturn returnresult = sendLogisticsResult.getResults()
					.get(0);

			Logger.verifyEquals(v1sendlogisticsBean.getDeliver_orders().get(0)
					.getOrder_id(), (long) returnresult.getOrder_id(), "验证Code");
			Logger.verifyEquals(true, returnresult.isExec_success(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1sendlogistics_023() {
		Logger.start(true, "订单发货， 补录一个国内非鉴定包裹");
		try {

			TradingServiceResp placeOrderResp = TradingPlaceAuthenticateCallService
					.placeOrderWithAuthenticate(
							AuthenticateFreightTypeEnum.BUYER, BigDecimal.ONE,
							AuthenticateFeeTypeEnum.BUYER, BigDecimal.TEN);
			
			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();
			
			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);
			Thread.sleep(3000);

			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, "Y013", 1, true);
			Thread.sleep(3000);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			DeliverOrder deliverOrder = new DeliverOrder();

			deliverOrder.setOrder_id(orderId);
			deliverOrder.setLogistics_company_id("Y037");
			deliverOrder.setTracking_number(TestDataManager.getRandomNum(13));
			deliverOrder.setIs_domestic_delivery(true);
			deliverOrder.setAuthenticate_package(false);

			List<DeliverOrder> orders = new ArrayList<>();
			orders.add(deliverOrder);

			v1sendlogisticsBean.setDeliver_orders(orders);

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(v1sendlogisticsBean));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.order.deliver",
							app_id);
			v1sendlogisticsCall.setUrl(url);

			v1sendlogisticsCall.setData(openapiReq);
			v1sendlogisticsCall.callService();

			Logger.verifyEquals("0000", v1sendlogisticsCall.getCode(), "验证Code");

			SendLogisticsResult sendLogisticsResult = v1sendlogisticsCall
					.getSendLogisticsResult();
			SendLogisticsReturn returnresult = sendLogisticsResult.getResults()
					.get(0);

			Logger.verifyEquals(v1sendlogisticsBean.getDeliver_orders().get(0)
					.getOrder_id(), (long) returnresult.getOrder_id(), "验证Code");
			Logger.verifyEquals(true, returnresult.isExec_success(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}